﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.DTO;
using DXApplicationTangche.service;
using Kingdee.BOS.WebApi.Client;
using mendian;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
using static DXApplicationTangche.UC.金蝶.dto.MaterialResultDTO;
using DXApplicationTangche.UC.金蝶.dto;
using static DXApplicationTangche.UC.金蝶.dto.MaterialDTO;
using DXApplicationTangche.UC.下单MTO.Service;
using DXApplicationTangche.UC.面料库存.入库.service;

namespace DXApplicationTangche.UC.订单一览新.辅料.service
{
    public class 辅料Service
    {
        /// <summary>
        /// 上传辅料图片
        /// </summary>
        /// <param name="subMaterialCode"></param>
        /// <param name="FileName"></param>
        public static void uploadAccessoryFileByCode(String subMaterialCode, String FileName)
        {
            FileService
                .UploadRequest(
                    URL.接口url + "/image/uploadAccessoryFileByCode?subMaterialCode=" + subMaterialCode,
                    FileName,
                    Path.GetFileName(FileName),
                    "file"
                );
        }
        /// <summary>
        /// 保存辅料spu
        /// </summary>
        /// <param name="subMaterialCode"></param>
        /// <param name="subMaterialName"></param>
        /// <param name="subMaterialSupplier"></param>
        /// <param name="subMaterialTypeId"></param>
        /// <param name="subMaterialType"></param>
        public static void saveSubMaterialSpu(
            String subMaterialCode,
            String subMaterialName,
            String subMaterialSupplier,
            String subMaterialTypeId,
            String subMaterialType)
        {
            RestCall.httpGetMethod(
                URL.接口url + "/acc/saveSubMaterialSpu?subMaterialCode=" + subMaterialCode 
                + "&subMaterialName=" + subMaterialName
                + "&subMaterialSupplier=" + subMaterialSupplier
                + "&subMaterialTypeId=" + subMaterialTypeId
                + "&subMaterialType=" + subMaterialType
            );
        }

        /// <summary>
        /// 保存辅料sku
        /// </summary>
        /// <param name="subMaterialCode"></param>
        /// <param name="subMaterialSpec"></param>
        /// <param name="fId"></param>
        /// <param name="fNumber"></param>
        public static PlainMessageResult saveSubMaterialSku(
            String subMaterialCode,
            String subMaterialSpec,
            String fId,
            String fNumber
            )
        {
            return
                FunctionHelper.JsonDeserialization<PlainMessageResult>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/acc/saveSubMaterialSku?subMaterialCode=" + subMaterialCode
                        + "&subMaterialSpec=" + subMaterialSpec
                        + "&fId=" + fId
                        + "&fNumber=" + fNumber
                    )
                );
        }
        //public static PlainMessageResult 金蝶辅料SKU保存(String fnumber,String subMaterialCode, String subMaterialName, String subMaterialType,String subMaterialSpec)
        //{
        //    // 使用webapi引用组件Kingdee.BOS.WebApi.Client.dll
        //    K3CloudApiClient client = new K3CloudApiClient("http://192.168.3.251/k3cloud/");
        //    var loginResult = client.ValidateLogin("6128407938e2f2", "Administrator", "Sshirt@1234", 2052);
        //    var resultType = JObject.Parse(loginResult)["LoginResultType"].Value<int>();
        //    //登录结果类型等于1，代表登录成功
        //    if (resultType == 1)
        //    {
        //        #region 金蝶接口
        //        //保存
        //        String result = client.Save("BD_MATERIAL", FunctionHelper.JsonSerialization(new Root(subMaterialCode, subMaterialName, fnumber, subMaterialType, subMaterialSpec)));
        //        //根据保存返回值取fId Fnumber
        //        KingDeeAddResultRoot materialResultRoot;
        //        try
        //        {
        //            materialResultRoot = FunctionHelper.JsonDeserialization<KingDeeAddResultRoot>(result);
        //        }
        //        catch
        //        {
        //            return new PlainMessageResult(ConstPlainMessageResult.METHOD_NOT_ALLOWED, "金蝶辅料保存失败");
        //        }

        //        //提交
        //        String Submitresult = client.Submit("BD_MATERIAL", FunctionHelper.JsonSerialization(new MaterialSubmitDTO(materialResultRoot.Result.Number, materialResultRoot.Result.Id.ToString())));
        //        //审核
        //        String SupplierVerifyresult = client.Audit("BD_MATERIAL", FunctionHelper.JsonSerialization(new MaterialVerifyDTO(materialResultRoot.Result.Number, materialResultRoot.Result.Id.ToString())));
        //        #endregion

        //        //调用保存辅料接口
        //        return saveSubMaterialSku(subMaterialCode, subMaterialSpec, materialResultRoot.Result.Id.ToString(), materialResultRoot.Result.Number);
        //    }
        //    else
        //    {
        //        return new PlainMessageResult(ConstPlainMessageResult.METHOD_NOT_ALLOWED,"金蝶辅料保存失败");
        //    }
        //}

        /// <summary>
        /// 取辅料SPU一览
        /// </summary>
        /// <param name="facade"></param>
        /// <returns></returns>
        public static List<SubMaterialSpuDao> getSubMaterialSpuAll()
        {
            return
                FunctionHelper.JsonDeserialization<List<SubMaterialSpuDao>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/acc/getSubMaterialSpuAll"
                        )
                    );
        }
        public static MaterialMessageResult 辅料品番合法性判断(String subMaterialCode)
        {
            if (String.IsNullOrEmpty(subMaterialCode))
            {
                return new MaterialMessageResult(false, "辅料品番不能为空");
            }
            if (subMaterialCode.Contains("/"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'/'");
            }
            if (subMaterialCode.Contains("\\"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'\\'");
            }
            if (subMaterialCode.Contains("+"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'+'");
            }
            if (subMaterialCode.Contains("!"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'!'");
            }
            if (subMaterialCode.Contains("("))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'('");
            }
            if (subMaterialCode.Contains(")"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符')'");
            }
            if (subMaterialCode.Contains(":"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符':'");
            }
            if (subMaterialCode.Contains("*"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'*'");
            }
            if (subMaterialCode.Contains("["))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'['");
            }
            if (subMaterialCode.Contains("]"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符']'");
            }
            if (subMaterialCode.Contains("^"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'^'");
            }
            if (subMaterialCode.Contains("&"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'&'");
            }
            if (subMaterialCode.Contains("?"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'?'");
            }
            if (subMaterialCode.Contains("{"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'{'");
            }
            if (subMaterialCode.Contains("}"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'}'");
            }
            if (subMaterialCode.Contains("|"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'|'");
            }
            if (subMaterialCode.Contains("~"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'~'");
            }
            if (subMaterialCode.Contains("#"))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含特殊字符'#'");
            }
            if (subMaterialCode.Contains(" "))
            {
                return new MaterialMessageResult(false, "辅料品番不能包含空格");
            }
            return new MaterialMessageResult(true, "");
        }
        /// <summary>
        /// 根据辅料品番查询对应SKU一览
        /// </summary>
        /// <param name="subMaterialCode"></param>
        /// <returns></returns>
        public static List<SubMaterialSkuDTO> getSubMaterialSkuListBySubMaterialCode(String subMaterialCode)
        {
            return
                FunctionHelper.JsonDeserialization<List<SubMaterialSkuDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/acc/getSubMaterialSkuListBySubMaterialCode?subMaterialCode=" + subMaterialCode
                        )
                    );
        }

        public List<DTO辅料一览> DTO辅料一览s = new List<DTO辅料一览>();
        public List<DTO辅料CheckList> DTO辅料CheckLists = new List<DTO辅料CheckList>();
        public static List<DTO辅料类别> get辅料类别一览(Boolean facade)
        {
            return
                FunctionHelper.JsonDeserialization<List<DTO辅料类别>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/acc/getAccessoryCatalogIndexDTOAllByFacade?facade=" + facade
                        )
                    );
        }
        #region 辅料维护
        public static String post辅料保存(DTO辅料一览 dTO辅料一览, OpenFileDialog ofd)
        {
            return
                FileService.UploadRequest(
                    URL.接口url + "/acc/saveAccessory?subMaterialTypeId=" + dTO辅料一览.subMaterialTypeId
                                                    + "&subMaterialType=" + dTO辅料一览.subMaterialType
                                                    + "&subMaterialSupplier=" + dTO辅料一览.subMaterialSupplier
                                                    + "&subMaterialPicture=" + dTO辅料一览.subMaterialPicture
                                                    + "&subMaterialNumber=" + dTO辅料一览.subMaterialNumber
                                                    + "&subMaterialCode=" + dTO辅料一览.subMaterialCode
                                                    + "&subMaterialName=" + dTO辅料一览.subMaterialName
                                                    + "&subMaterialSpec=" + dTO辅料一览.subMaterialSpec
                                                    + "&subMaterialSpecDesc=" + dTO辅料一览.subMaterialSpecDesc,
                    ofd.FileName,
                    Path.GetFileName(ofd.FileName),
                    "multipartFile"
                );
        }

        public static List<DTO辅料一览> get类别下辅料一览(String accessoryCatalogId, int pageIndex, int pageSize)
        {
            return
                FunctionHelper.JsonDeserialization<List<DTO辅料一览>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/acc/getAccessoryByCatalogId?accessoryCatalogId=" + accessoryCatalogId + "&pageIndex=" + pageIndex + "&pageSize=" + pageSize
                        )
                    );
        }
        #endregion

        #region 辅料全查询
        public static Dictionary<String, List<DTO辅料一览>> get全辅料一览()
        {
            return
                FunctionHelper.JsonDeserialization<Dictionary<String, List<DTO辅料一览>>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/acc/getAccessoryAll"
                        )
                    );
        }
        /// <summary>
        /// 取辅料一览(金蝶)
        /// </summary>
        /// <returns></returns>
        public static List<AccessoryKingDeeDTO> getAccessoryWithKingDeeInfoAll()
        {
            return
                FunctionHelper.JsonDeserialization<List<AccessoryKingDeeDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/acc/getAccessoryWithKingDeeInfoAll"
                        )
                    );
        }
        #endregion

        #region 辅料下单
        /// <summary>
        /// 选择辅料类别生产下拉checkBoxList列表
        /// </summary>
        /// <param name="materialCode"></param>
        /// <param name="accessoryCatalogId"></param>
        public static List<DTO辅料一览> get辅料CheckList(String materialCode, String accessoryCatalogId)
        {
            try
            {
                return
                    FunctionHelper.JsonDeserialization<List<DTO辅料一览>>(
                        RestCall.httpGetMethod(
                            URL.接口url + "/acc/getAccessoryDTOWithOrder?materialCode=" + materialCode + "&accessoryCatalogId=" + accessoryCatalogId
                            )
                        );
            }
            catch (Exception)
            {
                return new List<DTO辅料一览>();
            }
        }
        public static List<DTO辅料位置> get辅料位置(String accessoryCatalogId)
        {
            try
            {
                return
                    FunctionHelper.JsonDeserialization<List<DTO辅料位置>>(
                        RestCall.httpGetMethod(
                            URL.接口url + "/acc/getAccessoryFacadePositionByCatalogId?accessoryCatalogId=" + accessoryCatalogId
                            )
                        );
            }
            catch (Exception)
            {
                return new List<DTO辅料位置>();
            }
        }
        /// <summary>
        /// 根据辅料编码查询辅料
        /// </summary>
        /// <param name="accessoryCode"></param>
        /// <returns></returns>
        public static DTO辅料一览 getAccessoryByAccessoryCode(String accessoryCode)
        {
            try
            {
                return
                    FunctionHelper.JsonDeserialization<DTO辅料一览>(
                        RestCall.httpGetMethod(
                            URL.接口url + "/acc/getAccessoryByCode?accessoryCode=" + accessoryCode
                            )
                        );
            }
            catch (Exception)
            {
                return new DTO辅料一览();
            }
        }
        #endregion

        //public static Boolean 金蝶辅料保存(String fnumber,DTO辅料一览 dTO辅料)
        //{
        //    // 使用webapi引用组件Kingdee.BOS.WebApi.Client.dll
        //    K3CloudApiClient client = new K3CloudApiClient("http://192.168.3.251/k3cloud/");
        //    var loginResult = client.ValidateLogin("6128407938e2f2", "Administrator", "Sshirt@1234", 2052);
        //    var resultType = JObject.Parse(loginResult)["LoginResultType"].Value<int>();
        //    //登录结果类型等于1，代表登录成功
        //    if (resultType == 1)
        //    {
        //        #region 金蝶接口
        //        //保存
        //        String result = client.Save("BD_MATERIAL", FunctionHelper.JsonSerialization(new Root(dTO辅料.subMaterialCode, dTO辅料.subMaterialName, fnumber, dTO辅料.subMaterialType)));
        //        //根据保存返回值取fId Fnumber
        //        KingDeeAddResultRoot materialResultRoot;
        //        try
        //        {
        //            materialResultRoot = FunctionHelper.JsonDeserialization<KingDeeAddResultRoot>(result);
        //        }
        //        catch
        //        {
        //            return false;
        //        }

        //        //提交
        //        String Submitresult = client.Submit("BD_MATERIAL", FunctionHelper.JsonSerialization(new MaterialSubmitDTO(materialResultRoot.Result.Number, materialResultRoot.Result.Id.ToString())));
        //        //审核
        //        String SupplierVerifyresult = client.Audit("BD_MATERIAL", FunctionHelper.JsonSerialization(new MaterialVerifyDTO(materialResultRoot.Result.Number, materialResultRoot.Result.Id.ToString())));
        //        #endregion

        //        //调用保存辅料接口
        //        RestCall.PostHttp(URL.接口url + "/material/saveAccessoryWithKingDeeInfo?fId=" +
        //            materialResultRoot.Result.Id.ToString() + "&fNumber=" + materialResultRoot.Result.Number,
        //            FunctionHelper.JsonSerialization(dTO辅料)
        //            );
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}

    }
    public class SubMaterialSpuDao
    {
        public String subMaterialCode { get; set; }//品番（供应商编码）
        public String subMaterialName { get; set; }//辅料名称
        public String subMaterialSupplier { get; set; }//供应商
                                                       //  辅料类别
        public String subMaterialTypeId { get; set; }//辅料类别id
        public String subMaterialType { get; set; }//辅料类别
        public DateTime createDate { get; set; }
        public List<SubMaterialSkuDTO> subMaterialSkuDTOS { get; set; } = new List<SubMaterialSkuDTO>();
        public SubMaterialSpuDao()
        {

        }
    }

    public class SubMaterialSkuDTO
    {
        public String id { get; set; }
        public String subMaterialCode { get; set; }//品番（供应商编码）外键
        public String subMaterialSpec { get; set; }//规格
        /*
         *  金蝶信息
         */
        public String fId { get; set; } //  金蝶物料主键
        public String fNumber { get; set; }   //    金蝶物料号
        public DateTime kingDeeSyncDate { get; set; }   //  金蝶同步时间
        public SubMaterialSkuDTO()
        {

        }
    }
    /// <summary>
    /// 金蝶辅料清单
    /// </summary>
    public class AccessoryKingDeeDTO
    {
        //  辅料类别
        public String subMaterialTypeId { get; set; }//辅料类别id
        public String subMaterialType { get; set; }//辅料类别

        //  辅料基础属性
        public String subMaterialSupplier { get; set; }//供应商
        public String subMaterialPicture { get; set; }//图片
        public String subMaterialNumber { get; set; }//品番（供应商编码）
        public String subMaterialCode { get; set; }//辅料编码
        public String subMaterialName { get; set; }//辅料名称
        public String subMaterialSpec { get; set; }//规格
        public String subMaterialSpecDesc { get; set; }//规格描述

        /*
         *  金蝶信息
         */
        public String fId { get; set; } //  金蝶物料主键
        public String fNumber { get; set; }  //    金蝶物料号
        public DateTime kingDeeSyncDate { get; set; }  //  金蝶同步时间
        public AccessoryKingDeeDTO()
        {

        }
    }
    public class DTO辅料类别
    {
        public String accessoryCatalogId { get; set; }  //  辅料类别ID
        public String accessoryCatalogName { get; set; }    //  辅料类别名称
        public Boolean virtualStock { get; set; }    //  是否虚拟库存，目前只涉及配料，配料和面料是混的。配料要单独选择，不能跟辅料混
        public Boolean facade { get; set; } //  是否外观设计
        public Boolean hasPositionDefine { get; set; }    //  是否定义位置
        public Boolean hasColorDefine { get; set; } //  是否定义颜色
        public String preWipWbsCode { get; set; }   //  产前工序编码
        public List<String> wipWbsCodes { get; set; }   //  在制品工序编码
        public Boolean requireUnitConsumption { get; set; } //  是否需要单耗定义
        public DTO辅料类别()
        {

        }
    }
    public class DTO辅料位置
    {
        public String subMaterialPositionId { get; set; }//辅料位置ID
        public String subMaterialPosition { get; set; }//辅料位置
        public DTO辅料位置()
        {

        }
    }
    public class DTO辅料CheckList
    {
        public String code { get; set; }//
        public String name { get; set; }//
        public Image pic { get; set; }//
        public DTO辅料CheckList(DTO辅料一览 dTO)
        {
            this.code = dTO.subMaterialCode;
            this.name = dTO.subMaterialName + " " + dTO.subMaterialNumber + " " + dTO.subMaterialSpecDesc;
            try
            {
                this.pic
                    = FileService.GetImageByUrl(
                        URL.图片url + URL.辅料图片路径 + dTO.subMaterialPicture
                        );
            }
            catch
            {
                this.pic = FunctionHelper.getSSHIRT();
            }
        }
    }
    public class DTO辅料一览
    {
        public String subMaterialTypeId { get; set; }//辅料类别id
        public String subMaterialType { get; set; }//辅料类别
        public String subMaterialSupplier { get; set; }//供应商
        public String subMaterialNumber { get; set; }//品番（供应商编码）
        public String subMaterialCode { get; set; }//辅料编码
        public String subMaterialName { get; set; }//辅料名称
        public String subMaterialSpec { get; set; }//规格
        public String subMaterialSpecDesc { get; set; }//规格码
        public String subMaterialPicture { get; set; }//图片
        public DTO辅料一览()
        {

        }
        public DTO辅料一览(StyleAccessoryDTO dTO)
        {
            this.subMaterialTypeId = dTO.subMaterialTypeId;
            this.subMaterialType = dTO.subMaterialType;
            this.subMaterialSupplier = dTO.subMaterialSupplier;
            this.subMaterialNumber = dTO.subMaterialNumber;
            this.subMaterialCode = dTO.subMaterialCode;
            this.subMaterialName = dTO.subMaterialName;
            this.subMaterialSpec = dTO.subMaterialSpec;
            //this.subMaterialSpecDesc = dTO.subMaterialSpec;
            this.subMaterialPicture = dTO.subMaterialPicture;
        }

        public DTO辅料一览(string subMaterialTypeId, string subMaterialType, string subMaterialSupplier, string subMaterialNumber, string subMaterialCode, string subMaterialName, string subMaterialSpecDesc, string subMaterialPicture)
        {
            this.subMaterialTypeId = subMaterialTypeId;
            this.subMaterialType = subMaterialType;
            this.subMaterialSupplier = subMaterialSupplier;
            this.subMaterialNumber = subMaterialNumber;
            this.subMaterialCode = subMaterialCode;
            this.subMaterialName = subMaterialName;
            this.subMaterialSpecDesc = subMaterialSpecDesc;
            this.subMaterialPicture = subMaterialPicture;
        }
    }
    public class 标识StyleAccessoryDTO
    {
        public Boolean ifStore { get; set; }
        public List<StyleAccessoryDTO> styleAccessoryDTOs { get; set; }
        public 标识StyleAccessoryDTO(Boolean ifStore, List<StyleAccessoryDTO> styleAccessoryDTOs)
        {
            this.ifStore = ifStore;
            this.styleAccessoryDTOs = styleAccessoryDTOs;
        }
    }
    public class StyleAccessoryDTO //DTO辅料
    {
        public String subMaterialTypeId { get; set; }//辅料类别id
        public String subMaterialType { get; set; }//辅料类别
        public String subMaterialSupplier { get; set; }//供应商
        public String subMaterialNumber { get; set; }//品番（供应商编码）
        public String subMaterialCode { get; set; }//辅料编码
        public String subMaterialName { get; set; }//辅料名称
        public String subMaterialSpec { get; set; }//规格
        public String subMaterialPositionId { get; set; }//位置
        public String subMaterialPosition { get; set; }//位置
        public String subMaterialColorId { get; set; }//颜色
        public String subMaterialColor { get; set; }//颜色
        public Double subMaterialCount { get; set; }//单耗（数量）
        public String subMaterialRemarks { get; set; }//备注
        public String subMaterialPicture { get; set; }//图片
        public StyleAccessoryDTO()
        {

        }
        public StyleAccessoryDTO(DTO辅料一览 dTO)
        {
            this.subMaterialTypeId = dTO.subMaterialTypeId;
            this.subMaterialType = dTO.subMaterialType;
            this.subMaterialSupplier = dTO.subMaterialSupplier;
            this.subMaterialNumber = dTO.subMaterialNumber;
            this.subMaterialCode = dTO.subMaterialCode;
            this.subMaterialName = dTO.subMaterialName;
            this.subMaterialSpec = dTO.subMaterialSpec;
            this.subMaterialPicture = dTO.subMaterialPicture;
        }
        public StyleAccessoryDTO(
            DTO辅料一览 dTO,
            String subMaterialPositionId,
            String subMaterialPosition,
            String subMaterialColorId,
            String subMaterialColor,
            Double subMaterialCount,
            String subMaterialRemarks)
        {
            this.subMaterialTypeId = dTO.subMaterialTypeId;
            this.subMaterialType = dTO.subMaterialType;
            this.subMaterialSupplier = dTO.subMaterialSupplier;
            this.subMaterialNumber = dTO.subMaterialNumber;
            this.subMaterialCode = dTO.subMaterialCode;
            this.subMaterialName = dTO.subMaterialName;
            this.subMaterialSpec = dTO.subMaterialSpec;
            this.subMaterialPicture = dTO.subMaterialPicture;
            this.subMaterialPositionId = subMaterialPositionId;
            this.subMaterialPosition = subMaterialPosition;
            this.subMaterialColorId = subMaterialColorId;
            this.subMaterialColor = subMaterialColor;
            this.subMaterialCount = subMaterialCount;
            this.subMaterialRemarks = subMaterialRemarks;

        }

        public StyleAccessoryDTO(string subMaterialTypeId, string subMaterialType, string subMaterialSupplier, string subMaterialNumber, string subMaterialCode, string subMaterialName, string subMaterialSpec, String subMaterialPositionId, string subMaterialPosition, String subMaterialColorId, string subMaterialColor, double subMaterialCount, string subMaterialRemarks, String subMaterialPicture)
        {
            this.subMaterialTypeId = subMaterialTypeId;
            this.subMaterialType = subMaterialType;
            this.subMaterialSupplier = subMaterialSupplier;
            this.subMaterialNumber = subMaterialNumber;
            this.subMaterialCode = subMaterialCode;
            this.subMaterialName = subMaterialName;
            this.subMaterialSpec = subMaterialSpec;
            this.subMaterialPositionId = subMaterialPositionId;
            this.subMaterialPosition = subMaterialPosition;
            this.subMaterialColorId = subMaterialColorId;
            this.subMaterialColor = subMaterialColor;
            this.subMaterialCount = subMaterialCount;
            this.subMaterialRemarks = subMaterialRemarks;
            this.subMaterialPicture = subMaterialPicture;
        }
    }
    public class DTO辅料显示
    {
        public String subMaterialTypeId { get; set; }//辅料类别id
        public String subMaterialType { get; set; }//辅料类别
        public String subMaterialSupplier { get; set; }//供应商
        public String subMaterialNumber { get; set; }//品番（供应商编码）
        public String subMaterialCode { get; set; }//辅料编码
        public String subMaterialName { get; set; }//辅料名称
        public String subMaterialSpec { get; set; }//规格
        public String subMaterialPositionId { get; set; }//位置
        public String subMaterialPosition { get; set; }//位置
        public String subMaterialColorId { get; set; }//颜色
        public String subMaterialColor { get; set; }//颜色
        public Double subMaterialCount { get; set; }//单耗（数量）
        public String subMaterialRemarks { get; set; }//备注
        public Image subMaterialPicture { get; set; }//图片
        public DTO辅料显示()
        {

        }
        public DTO辅料显示(StyleAccessoryDTO dTO)
        {
            this.subMaterialTypeId = dTO.subMaterialTypeId;
            this.subMaterialType = dTO.subMaterialType;
            this.subMaterialSupplier = dTO.subMaterialSupplier;
            this.subMaterialNumber = dTO.subMaterialNumber;
            this.subMaterialCode = dTO.subMaterialCode;
            this.subMaterialName = dTO.subMaterialName;
            this.subMaterialSpec = dTO.subMaterialSpec;
            this.subMaterialPositionId = dTO.subMaterialPositionId;
            this.subMaterialPosition = dTO.subMaterialPosition;
            this.subMaterialColorId = dTO.subMaterialColorId;
            this.subMaterialColor = dTO.subMaterialColor;
            this.subMaterialCount = dTO.subMaterialCount;
            this.subMaterialRemarks = dTO.subMaterialRemarks;
            try
            {
                this.subMaterialPicture
                    = FileService.GetImageByUrl(
                        URL.图片url + URL.辅料图片路径 + dTO.subMaterialPicture
                        );
            }
            catch
            {
                this.subMaterialPicture = FunctionHelper.getSSHIRT();
            }
            //this.subMaterialPicture = FunctionHelper.getSSHIRT();
        }

        public DTO辅料显示(string subMaterialTypeId, string subMaterialType, string subMaterialSupplier, string subMaterialNumber, string subMaterialCode, string subMaterialName, string subMaterialSpec, string subMaterialPosition, string subMaterialColor, double subMaterialCount, string subMaterialRemarks)
        {
            this.subMaterialTypeId = subMaterialTypeId;
            this.subMaterialType = subMaterialType;
            this.subMaterialSupplier = subMaterialSupplier;
            this.subMaterialNumber = subMaterialNumber;
            this.subMaterialCode = subMaterialCode;
            this.subMaterialName = subMaterialName;
            this.subMaterialSpec = subMaterialSpec;
            this.subMaterialPosition = subMaterialPosition;
            this.subMaterialColor = subMaterialColor;
            this.subMaterialCount = subMaterialCount;
            this.subMaterialRemarks = subMaterialRemarks;
        }
    }
}
